Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: SVG optimization #1350

Merged

Conversation

petri-lipponen-movesense
  • Optimized svg image rendering by avoiding deepcopy (uses copy=False flag when calling add_item in svg.build_group where item is known to be not re-used). This reduces time to render SVG's by 50%-70%.

Checklist:

  • A unit test is covering the code added / modified by this PR. N/A

  • This PR is ready to be merged

  • In case of a new feature, docstrings have been added, with also some documentation in the docs/ folder N/A

  • A mention of the change is present in CHANGELOG.md

By submitting this pull request, I confirm that my contribution is made under the terms of the GNU LGPL 3.0 license.

- Use copy=False flag when calling add_item in svg.build_group
@petri-lipponen-movesense
Copy link
Author

I'm sure there are other parts of the SVG handling that can help, but this seemed to be the low hanging fruit. In my case it dropped ~100 page PDF generation from 27 minutes to 13...

@Lucas-C
Copy link
Member

Lucas-C commented Jan 17, 2025

@allcontributors please add @petri-lipponen-movesense for code

Copy link

@Lucas-C

I've put up a pull request to add @petri-lipponen-movesense! 🎉

CHANGELOG.md Outdated Show resolved Hide resolved
@Lucas-C
Copy link
Member

Lucas-C commented Jan 17, 2025

Wow, thank you very much @petri-lipponen-movesense! 👍

Excellent job, thank you very much for this contribution ❤️

@Lucas-C Lucas-C merged commit b366272 into py-pdf:master Jan 17, 2025
@petri-lipponen-movesense petri-lipponen-movesense deleted the feature/svg_optimization branch January 20, 2025 06:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants